Fill Document
The Fill Document service task takes a Microsoft Word file that has been prepared in accordance with the DocX standard and creates a copy pre-filled with data from within your process.
Workflow v1
Array Handling
To deal with an unknown number of items in a list DocX has implemented loops. In order to put the array into the service task use the JSON.stringify function to convert your array from within your process.
Document Example
{project.title | upper} Start: {project.start_date | endOf: ‘day’ | format: ‘dd-MM-yyyy'} {#project.tasks} {title} {start_date | format:’dd/MM/yy’} {due_date} {total | currency:’fil-PH’:’PHP’}{/}
Supported Filter Expressions
After the pipe are filter expressions. You can use these to alter the input text before it is placed in the document. Currently supported filter expressions include
Expression | Description | Example |
---|---|---|
upper | Sets the text to be uppercase | {project.title | upper} |
endOf | Moves a date to the end of the given unit* | {project.start_date | endOf:'week'} |
startOf | Moves a date to the start of the given unit | {project.start_date | startOf:'week'} |
format | Formats a given date. See supported date formats | {project.start_date | format:'dd-MM-yy'} |
currency | Formats a given number to the specified locale and currency. Locale defaults to 'en-au' and currency defaults to 'AUD' | {project.cost | currency:'en-de':'USD'} |
where | Filters an array by the specified string expression | {project.tasks | where:"status != 'Completed'"} |
sumBy | Sums an array by the specified field | {projects.invoices | sumBy:"amount"} |
parse | Given a bunch of JSON data in a string, parses into JSON object. | {#projects.tasks | parse} {assigned_to} {} |
*Units:
- year
- quarter
- month
- week
- day
- hour
- minute
- second
- millisecond
Document Themes
You can set the Document theme values using the Theme tab. These values match up with the custom theme configurator found in Word. Do note that Word Online and Word the application have different behaviour when displaying themed documents. The following values will be ignored in Word locally, but display correctly in Word Online
Text/Background - Dark 1 : Sets to Black
Text/Background - Light 1 : Sets to White